home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / docs / ascii / internet / htmldo / htmlform.txt < prev    next >
Encoding:
Text File  |  1995-01-25  |  16.6 KB  |  385 lines

  1. Mosaic for X version 2.0 Fill-Out Form Support
  2.  
  3. Here are details about what we have implemented for fill-out forms in
  4. help-on-version-2.0.html  -  Mosaic for X 2.0
  5.  
  6. The FORM Tag
  7.  
  8. The FORM tag specifies a fill-out form within an HTML document.  More than one 
  9. fill-out form can be in a single document, but forms cannot be nested.
  10.  
  11. <FORM ACTION="url"> ... </FORM>
  12.  
  13. The attributes are as follows:
  14.  
  15. ACTION is the URL of the query server to which the form contents will be 
  16. submitted; if this attribute is absent, then the current document URL will be 
  17. used.
  18.  
  19. METHOD is the HTTP/1.0 method used to submit the fill-out form to a query 
  20. server.  Which method you use depends on how your particular server works; we 
  21. strongly recommend use of (or near-term migration to) POST.  The valid choices 
  22. are:
  23.  
  24. GET -- this is the default method and causes the fill-out form contents to be 
  25. appended to the URL as if they were a normal query.
  26.  
  27. POST -- this method causes the fill-out form contents to be sent to the server 
  28. in a data body rather than as part of the URL.
  29.  
  30. ENCTYPE specifies the encoding for the fill-out form contents.  This attribute 
  31. only applies if METHOD is set to POST -- and even then, there is only one 
  32. possible value (the default, application/x-www-form-urlencoded) so far.
  33.  
  34. NOTE:  If you want to use the METHOD of type POST with the NCSA httpd you will 
  35. need to get version 1.0a5 or later.
  36.  
  37. Inside a FORM you can have anything except another FORM.  Specifically, INPUT, 
  38. SELECT, and TEXTAREA tags are used to specify interface elements within the 
  39. form.
  40.  
  41. Forms are not automatically visually differentiated from the rest of a 
  42. document.  We recommend using the HR (horizontal rule) tag before and after a 
  43. form to cleanly differentiate it from surrounding text and/or other forms.
  44.  
  45. The INPUT Tag
  46.  
  47. The INPUT tag is used to specify a simple input element inside a FORM.  It is 
  48. a standalone tag; it does not surround anything and there is no terminating 
  49. tag -- i.e., it is used in much the same way as IMG.
  50.  
  51. In Mosaic for X, various types of INPUT tags are instantiated as Motif widgets 
  52. (text entry fields, toggle buttons, pushbuttons, etc.).
  53.  
  54. The attributes to INPUT are as follows:
  55.  
  56. TYPE must be one of: 
  57.  
  58. "text" (text entry field; this is the default)
  59.  
  60. "password" (text entry field; entered characters are represented as asterisks)
  61.  
  62. "checkbox" (a single toggle button; on or off)
  63.  
  64. "radio" (a single toggle button; on or off; other toggles with the same  NAME 
  65. are grouped into "one of many" behavior)
  66.  
  67. "submit" (a pushbutton that causes the current form to be packaged up into a 
  68. query URL and sent to a remote server)
  69.  
  70. "reset" (a pushbutton that causes the various input elements in the form to be 
  71. reset to their default values)
  72.  
  73. NAME is the symbolic name (not a displayed name -- normal HTML within the form 
  74. is used for that) for this input field.  This must be present for all types 
  75. but "submit" and "reset", as it is used when putting together the query string 
  76. that gets sent to the remote server when the filled-out form is submitted.
  77.  
  78. VALUE, for a text or password entry field, can be used to specify the default 
  79. contents of the field.  For a checkbox or a radio button, VALUE specifies the 
  80. value of the button when it is checked (unchecked checkboxes are disregarded 
  81. when submitting queries); the default value for a checkbox or radio button is 
  82. "on".  For types "submit" and "reset", VALUE can be used to specify the label 
  83. for the pushbutton.
  84.  
  85. CHECKED (no value needed) specifies that this checkbox or radio button is 
  86. checked by default; this is only appropriate for checkboxes and radio buttons.
  87.  
  88. SIZE is the physical size of the input field in characters; this is only 
  89. appropriate for text entry fields and password entry fields.  If this is not 
  90. present, the default is 20.  Multiline text entry fields can be specified as 
  91. SIZE=width,height; e.g. SIZE=60,12.  Note: the SIZE attribute should not be 
  92. used to specify multiline text entry fields now that the TEXTAREA tag is 
  93. available.
  94.  
  95. MAXLENGTH is the maximum number of characters that are accepted as input; this 
  96. is only appropriate for text entry fields and password entry fields (and only 
  97. for single-line text entry fields at that).  If this is not present, the 
  98. default will be unlimited.  The text entry field is assumed to scroll 
  99. appropriately if MAXLENGTH is greater than SIZE.
  100.  
  101. The SELECT Tag
  102.  
  103. Inside <FORM> ... </FORM>, any number of SELECT tags are allowed, freely 
  104. intermixed with other HTML elements (including INPUT and TEXTAREA elements) 
  105. and text (but not additional forms).  In Mosaic for X, SELECT tags are 
  106. instantiated as Motif option menus and scrolled lists.
  107.  
  108. Unlike INPUT, SELECT has both opening and closing tags.  Inside SELECT, only a 
  109. sequence of OPTION tags -- each followed by an arbitrary amount of plain text 
  110. (no HTML markup) -- is allowed; for example:
  111.  
  112.         <SELECT NAME="a-menu">
  113.         <OPTION> First option.
  114.         <OPTION> Second option.
  115.         </SELECT>
  116.  
  117. The attributes to SELECT are as follows:
  118.  
  119. NAME is the symbolic name for this
  120.     SELECT element.
  121.   This must be present, as it is used when putting together the
  122.   query string for the submitted form.
  123.  
  124. SIZE: if SIZE is 1 or if the SIZE attribute is missing, by default the SELECT 
  125. will be represented as a Motif option menu.  If SIZE is 2 or more, the SELECT 
  126. will be represented as a Motif scrolled list; the value of SIZE then 
  127. determines how many items will be visible.
  128.  
  129. MULTIPLE, if present (no value), specifies that the SELECT should allow 
  130. multiple selections (n of many behavior).  The presence of MULTIPLE forces the 
  131. SELECT to be represented as a Motif scrolled list, regardless of the value of 
  132. SIZE.
  133.  
  134. The attributes to OPTION are as follows:
  135.  
  136. SELECTED specifies that this option is selected by default.  If the SELECT 
  137. allows multiple selections (via the MULTIPLE attribute), multiple options can 
  138. be specified as SELECTED.
  139.  
  140. The TEXTAREA Tag
  141.  
  142. The TEXTAREA tag can be used to place a multiline text entry field with 
  143. optional default contents in a fill-out form.  The attributes to TEXTAREA are 
  144. as follows:
  145.  
  146. NAME is the symbolic name of the text entry field.
  147.  
  148. ROWS is the number of rows (vertical height in characters) of the text entry 
  149. field.
  150.  
  151. COLS is the number of columns (horizontal width in characters) of the text 
  152. entry field.
  153.  
  154. TEXTAREA fields automatically have scrollbars; any amount of text can be 
  155. entered in them.
  156.  
  157. The TEXTAREA element requires both an opening and a closing tag.  A TEXTAREA 
  158. with no default contents looks like this:
  159.  
  160.         <TEXTAREA NAME="foo" ROWS=4 COLS=40></TEXTAREA>
  161.  
  162. A TEXTAREA with default contents looks like this:
  163.  
  164. <PRE>
  165.         <TEXTAREA NAME="foo" ROWS=4 COLS=40>
  166.         Default contents go here.
  167.         </TEXTAREA>
  168. </PRE>
  169.  
  170. The default contents must be straight ASCII text.  Newlines are
  171. respected (so in the above example there will be a newline both
  172. before and after "Default contents go here.").
  173.  
  174. Form Submission
  175.  
  176. For Method = GET
  177.  
  178. When the submit button is pressed, the contents of the form will be assembled 
  179. into a query URL that looks like this:
  180.  
  181.     action?name=value&name=value&name=value
  182.  
  183. ("action" here is the URL specified by the ACTION attribute to the FORM tag, 
  184. or the current document URL if no ACTION attribute was specified.)
  185.  
  186. Strange characters in any of the "name" or "value" instances will be escaped 
  187. as usual; this includes "=" and "&".  Note: This means that instances of 
  188. "=" that separate names and values, and instances of "&" that separate 
  189. name/value pairs, are not escaped.
  190.  
  191. For text and password entry fields, whatever the user typed in will be
  192. the value; if the user didn't type anything, the value will be empty
  193. but the "name=" part of the query string will still be present.
  194.  
  195. For checkboxes and radio buttons, the VALUE attribute specifies the value of a 
  196. checkbox or radio button when it is checked.  An unchecked checkbox is 
  197. disregarded completely when assembling the query string.  Multiple checkboxes 
  198. can have the same NAME (and different VALUEs), if desired.  Multiple radio 
  199. buttons intended to have "one of many" behavior should have the same NAME and 
  200. different VALUEs.
  201.  
  202. For Method = POST
  203.  
  204. The contents of the form are encoded exactly as with the GET method (above), 
  205. but rather than appending them to the URL specified by the form's ACTION 
  206. attribute as a query, the contents are sent in a data block as part of the 
  207. POST operation.  The ACTION attribute (if any) is the URL to which the data 
  208. block is POSTed.
  209.  
  210. Test Servers
  211.  
  212. If you wish to write a prototype fill-out form and test it against a
  213. query server that simply shows you what you submitted (with name/value
  214. pairs decoded and itemized), you can use the following:
  215.  
  216.      For METHOD="POST", use 
  217.      ACTION="http://hoohoo.ncsa.uiuc.edu/htbin-post/post-query"
  218.  
  219.      For METHOD="GET", use 
  220.      ACTION="http://hoohoo.ncsa.uiuc.edu/htbin/query"
  221.  
  222. C source code for the query and post-query programs is distributed with NCSA 
  223. httpd, in the ftp://ftp.ncsa.uiuc.edu/Web/httpd/Unix/ncsa_httpd/cgi/cgi-src 
  224. directory.
  225.  
  226. The fill-out form examples listed below use these query servers as
  227. their back ends, so you can see them in action and know what to
  228. expect with your own forms.
  229.  
  230. Important note: If you use the GET method in your form, you will notice that 
  231. the example GET server will choke if too much data (more than a couple hundred 
  232. bytes) is submitted at a time -- the server is passing the data to the form-
  233. processing module via a shell command line, and the maximum shell command line 
  234. length is being exceeded.  This problem does not exist with the POST method 
  235. and server.
  236.  
  237. Things To Note
  238.  
  239. Some things in the HTML+ spec aren't yet supported.  In particular, mailto 
  240. URLs aren't supported as actions yet, and also the Mosaic 2.0 support only 
  241. includes a subset of the allowable types of input fields (obviously "text" can 
  242. also serve as "url", "int", "float", and "date" but without intrinsic 
  243. range/error checking).
  244.  
  245. A "submit" element is necessary in all forms except those containing only a 
  246. single INPUT element of type TEXT (in which case Return in the text entry area 
  247. submits the form) or at least one INPUT element of type IMAGE (in which case a 
  248. click in the image submits the form).
  249.  
  250. Mosaic has a stealth feature: if a single text field is in a form and the NAME 
  251. of the text field is "isindex", then the submitted query will be just like you 
  252. are used to getting with ISINDEX -- "url?querystring" (i.e., not 
  253. "url?isindex=querystring").  This allows you to use simple fill-out forms in 
  254. your documents to point to existing query servers (including Gopher and WAIS 
  255. servers!).  This of course assumes that the POST method is not specified for 
  256. such forms.
  257.  
  258. There seems to be a bug under IRIX 5.1.0.1 and 5.1.1 (at least) that causes 
  259. text entry fields in forms to only be half as (physically) big as they should 
  260. be.  This is not a bug in Mosaic -- the fields are the correct size on all 
  261. other X servers we have seen, and this general geometry problem afflicts other 
  262. programs running under IRIX 5.1.0.1/5.1.1 also (e.g. Marc's Epoch windows come 
  263. up half as big as they should, etc.).  There's nothing we can do until SGI 
  264. fixes the bug in their X server.
  265.  
  266. ISINDEX Handling
  267.  
  268. Now that we have this fancy fill-out form support, we're supporting the 
  269. ISINDEX tag differently.  Instead of having a browser-interface method (dialog 
  270. box or text field) for entering a query, an instance of ISINDEX is 
  271. instantiated as a preloaded fill-out form suitable for entering a query; the 
  272. form is inlined at the location of the ISINDEX tag itself in the document.
  273.  
  274. Justifications for change:
  275.  
  276. Consistent approach to query mechanisms inside Mosaic.
  277.  
  278. Allow code and interface complexity to be reduced.
  279.  
  280. A few nasty problems were hitting the "popup text entry field" approach 
  281. attempted for prerelease 2; notably, lots of unavoidable flashing when field 
  282. popped up and down and intermittent but crippling Motif geometry management 
  283. problem.  This change removes those problems.
  284.  
  285. Everyone wants the ability to enter a query (and the corresponding widgets) to 
  286. be present only when the document is actually an ISINDEX document; this 
  287. provides that very cleanly.
  288.  
  289. This solves existing problem of when to retain contents of search field -- 
  290. since search field now exists on a per-document basis, this is very clean.
  291.  
  292. Encourage experimentation with fill-out forms by presenting an example for 
  293. existing query engines.
  294.  
  295. Examples 
  296.  
  297. Twelve examples are available.  All of the examples now use METHOD=POST.
  298.  
  299. Example 1 -- a ludicrously simple fill-out form.
  300. Example 2 -- three text entry fields.
  301. Example 3 -- text entry fields and checkboxes.
  302. Example 4 -- changing the default values of text entry fields and checkboxes.
  303. Example 5 -- changing various attributes of text entry fields.
  304. Example 6 -- multiple, independent forms in a single document.
  305. Example 7 -- radio buttons, "one of many" behavior.
  306. Example 8 -- password entry fields.
  307. Example 9 -- option menus.
  308. Example 10 -- scrolled lists with single and multiple selections.
  309. Example 11 -- multiline text entry areas.
  310. Example 12 -- image maps in forms.
  311. Example 13 -- forms with hidden elements.
  312.  
  313. Writing Your Own Fill-Out Form Query Engine
  314.  
  315. If you want to set up one or more query engines corresponding to fill-out 
  316. forms that you create for database accesses or other purposes, you may want to 
  317. take a look at  http://hoohoo.ncsa.uiuc.edu/docs/Overview.html - NCSA httpd 
  318. 1.0.  One of the example programs included with NCSA httpd is a sample fill-
  319. out form server (the same server used in the examples above, actually) and 
  320. will provide a good model for writing your own servers.
  321.  
  322. We strongly, strongly recommend use of the POST method with fill-out forms.  
  323. One reason: with the GET method, given the way many servers (e.g. NCSA httpd) 
  324. pass query strings from URLs to query server scripts, you run an excellent 
  325. chance of having the forms contents truncated by hardcoded shell command 
  326. argument lengths.  With POST (again, e.g., with NCSA httpd) you should be able 
  327. to do a total end run around such problems.
  328.  
  329. NCSA httpd 1.0 (the official release) should be out shortly and will contain 
  330. an example POST fill-out form server.
  331.  
  332. Fill-Out Forms in the Real World
  333.  
  334. Here are some fill-out forms in use in the Real World(tm).  For up-to-date 
  335. examples, search on "form" in ../whats-new.html - What's New.
  336.  
  337. http://cea-ftp.cea.berkeley.edu/Registration.html - Registration form.
  338.  
  339. http://www.cm.cf.ac.uk/Movies/moviequery.html - Cardiff's Movie Database 
  340. Browser
  341.  
  342. http://web.nexor.co.uk/archieplex-info/archieplexform.html - ArchiePlex forms 
  343. interface.
  344.  
  345. http://south.ncsa.uiuc.edu:8241/Free.html - Free For All
  346.  
  347. http://rs560.cl.msu.edu/weather/getmegif.html - weather map "order form".
  348.  
  349. http://doccenter.com/doccenter/home.html - Document Center is a hard copy 
  350. document delivery service specializing in government and industry 
  351. specifications and standards. Document Center has the complete Department of 
  352. Defense (DoD) Index of Specifications and Standards collection available, as 
  353. well as the complete collection of the American Society for Testing Materials 
  354. (ASTM).  The Center also has additional industry (ANSI, SAE, IPC, IEEE, EIA) 
  355. and govenment (NASA, DLA, FAA) documentation at its Silicon Valley location.
  356.  
  357. Another http://marvin.physik.uni-oldenburg.de/Docs/net-serv/archie-gate.html - 
  358. Archie gateway at Oldenburg.
  359.  
  360. Comments?
  361.  
  362. Please send mail to mosaic-x@ncsa.uiuc.edu.
  363.  
  364. <LI> <A HREF="example-1.html">Example 1</A> -- a ludicrously simple
  365.      fill-out form.
  366. <LI> <A HREF="example-2.html">Example 2</A> -- three text entry fields.
  367. <LI> <A HREF="example-3.html">Example 3</A> -- text entry fields and
  368.      checkboxes.
  369. <LI> <A HREF="example-4.html">Example 4</A> -- changing the default
  370.      values of text entry fields and checkboxes.
  371. <LI> <A HREF="example-5.html">Example 5</A> -- changing various
  372.      attributes of text entry fields.
  373. <LI> <A HREF="example-6.html">Example 6</A> -- multiple, independent
  374.      <I>forms</I> in a single document.
  375. <LI> <A HREF="example-7.html">Example 7</A> -- radio buttons, "one of
  376.      many" behavior.
  377. <LI> <A HREF="example-8.html">Example 8</A> -- password entry fields.
  378. <LI> <A HREF="example-9.html">Example 9</A> -- option menus.
  379. <LI> <A HREF="example-10.html">Example 10</A> -- scrolled lists with
  380.      single and multiple selections.
  381. <LI> <A HREF="example-11.html">Example 11</A> -- multiline text entry areas.
  382. <LI> <A HREF="example-12.html">Example 12</A> -- image maps in forms.
  383. <LI> <A HREF="example-13.html">Example 13</A> -- forms with hidden elements.
  384.  
  385.